<template>
  <div class="admin" style="display:flex;">
    <div style="width:18%">
        <el-menu
            :default-active="$route.path"
            router
            class="el-menu-vertical-demo"
            style="height:100vh;position:absolute;width:200px;text-align:left">

            <div style="position: reletive;margin-top:20px;margin-left:80px">
                <el-avatar :src="src" title="管理员"></el-avatar>
            </div>
            
            <el-menu-item index="/bloglist">
                <i class="el-icon-menu"></i>
                <span slot="title">首页</span>
            </el-menu-item>
            <el-menu-item index="/blogadd">
                <i class="el-icon-files"></i>
                <span slot="title">博客新增</span>
            </el-menu-item>
            

            <el-submenu index="1">
                <template slot="title">
                    <i class="el-icon-money"></i>
                    <span>分类</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="/blogtype">分类列表</el-menu-item>
                </el-menu-item-group>
            </el-submenu>
            <el-submenu index="2">
                <template slot="title">
                    <i class="el-icon-price-tag"></i>
                    <span>标签</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="/blogtag">标签列表</el-menu-item>
                </el-menu-item-group>
            </el-submenu>
            <el-menu-item index="/forme">
                <i class="el-icon-user"></i>
                <span slot="title">关于我</span>
            </el-menu-item>
        </el-menu> 
    </div>
    
    <div style="flex: 1;">
        <keep-alive>
           <router-view/>  
        </keep-alive>
    </div>
    
  </div>
</template>

<script>
export default {
    name:'Admin',
    data(){
        return{
            src:'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
            admin:{
                username:'',
                password:'',
            }
        }
    },
    created(){
        this.admin.username=this.$route.query.username
        this.admin.password=this.$route.query.password
        console.log(this.admin)
        this.$emit('admin',this.admin.username,this.admin.password)
    },
    methods:{
        logout(){}
    }
}
</script>